{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import pickle\n",
    "import matplotlib.pyplot as plt\n",
    "from collections import defaultdict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "DIR = \"../measurements\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "names = os.listdir(DIR)\n",
    "names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "token = 'pointnet2_charlesmsg_debug_ShapeNetDataset.pickle'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def visualize(token):\n",
    "    with open(os.path.join(DIR, token), \"rb\") as f:\n",
    "        data = pickle.load(f)\n",
    "        \n",
    "    to_print = defaultdict(list)\n",
    "    for split_name in data.keys():\n",
    "        split_data = data[split_name]\n",
    "        for layer_idx, layer in enumerate(split_data):\n",
    "            for radius in layer.keys():\n",
    "                radius_hist = layer[radius]\n",
    "                to_print[\"{}_{}\".format(layer_idx, radius)].append(radius_hist)\n",
    "\n",
    "    for key in to_print.keys():\n",
    "        print(key)\n",
    "        for data in to_print[key]:\n",
    "            plt.plot(data)\n",
    "        plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "visualize(token)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
